package org.hybre.seed.test;

import org.hybre.seed.core.action.*;
public class PersonActionTestCase extends BaseTestCase {

	 public PersonActionTestCase(String name) {
		super(name);
		
	}

	/**
	  * Invoke all interceptors and specify value of the action
	  * class' domain objects directly.
	  * @throws Exception Exception
	  */
	 public void testInterceptorsBySettingDomainObjects()
	         throws Exception {
	  UserAction action = (UserAction) createAction(UserAction.class,"/my-default", "list");
	  action.setId(123);
	  String result = proxy.execute();
	  assertEquals(result, "success");
	 }

	 /**
	  * Invoke all interceptors and specify value of action class'
	  * domain objects through request parameters.
	  * @throws Exception Exception
	  */
	 public void testInterceptorsBySettingRequestParameters()
	                     throws Exception {
	  createAction(UserAction.class, "/my-default", "remove");
	  request.addParameter("id", "123");
	  String result = proxy.execute();
	  assertEquals(result, "success");
	 }

	 /**
	  * Skip interceptors and specify value of action class'
	  * domain objects by setting them directly.
	  * @throws Exception Exception
	  */
	 public void testActionAndSkipInterceptors() throws Exception {
	  UserAction action = (UserAction) createAction(UserAction.class,"/my-default", "save");
	  action.setId(123);
	  String result = action.execute();
	  assertEquals(result, "success");
	 }
	}
